var express=require('express')
var goodRouter=express.Router()
//分页
goodRouter.get("/list",(req,res)=>{
    var {page,count}=req.query
    var newarr=arr.slice((page-1)*count,page*count)
    res.send({code:200,msg:'请求成功',list:newarr})

})

//模糊搜素
goodRouter.get("/search",(req,res)=>{
     var {searchkey}=req.query
     var newarr=arr.filter((item)=>{
        return new RegExp(searchkey).test(item.name)
     })
     res.send({code:200,msg:"查询成功！",list:newarr})
})

module.exports=goodRouter